<template>
	<div class="info">
		<v-header></v-header>
		<!--<div class="compile" v-on:click="compileClick">编辑</div>-->
		<!--<div class="head-portrait">
			<p>头像</p>

			<div class="form-group">
				<img :src="userData.avatar" class="portrait" />
				<img :src="isImage" v-if="isImage" class="portrait">
				<input type="file" class="form-control" @change="onFileChange">
			</div>

		</div>-->
		<!--<div v-if="isAdd">
			<mt-cell title="账 号" :value="userData.userName"></mt-cell>
			<mt-cell title="真实姓名" :value="userData.realName"></mt-cell>
		</div>
		<div v-if="!isAdd">
			<mt-field label="账 号" placeholder="请输入用户名" v-model="userData.userName"></mt-field>
			<mt-field label="真实姓名" placeholder="请输入用户名" v-model="userData.realName"></mt-field>
			<button class="button infoButton" v-on:click="saveClick">保存</button>
		</div>-->
		<div class="me">
			<div class="user-img">
				<img v-if='userData.imgUrl' v-bind:src="userData.imgUrl" :onerror="avatar">
				<img v-else-if="userData.sex === '男'" src="../../../kbc/h5/img/css/common/man.png">
				<img v-else-if="userData.sex === '女'" src="../../../kbc/h5/img/css/common/woman.png">
				<img v-else src="../../../kbc/h5/img/css/common/man.png">
			</div>
			<div class="title">
				<p class="name" v-if="userData.userName ===''">未设置账号</p>
				<p class="name" v-else>{{userData.userName}}</p>
				<p class="realName" v-if="userData.realName ===''">未设置真实姓名</p>
				<p class="realName" v-else>{{userData.realName}}</p>
				<p class="member">{{memberName}}</p>
			</div>
		</div>
		<!--<div class="div-padding-box">
			<mt-cell title="账 号" :value="userData.userName"></mt-cell>
			<mt-cell title="真实姓名" :value="userData.realName"></mt-cell>
		</div>-->
		<mt-cell title="个人持币" :value="teamData.userMoneyTotal"></mt-cell>
		<mt-cell title="团队持币" :value="teamData.teamMoneyTotal"></mt-cell>
		<mt-cell title="团队人数" :value="teamData.teamTotal"></mt-cell>
		<mt-cell title="手机号" :value="userData.phone"></mt-cell>
	</div>
</template>
<style>
	.info{margin-top: 4rem;}
	.info .me{ width: 100%; margin: 0 auto 1rem; padding: 1rem 0; background: #fff; display: flex; box-sizing: border-box; text-align:left;}
	.info .user-img{width:80px;text-align:left; padding:0 10px;}
	.info .user-img img{ width:80px; height:80px; border-radius: 50%;display: block;}
	.info .name{font-size:1.4rem; margin-bottom:1rem; font-weight: 700;}
	.info .realName{font-size:1.2rem; margin-bottom:1rem;}
	.info .member{font-size: 1.1rem;color: #FF4949;}
	.head-portrait{ position: relative; width: 100%; display: flex; box-sizing: border-box; padding:3rem 1rem; background: #fff;font-size: 16px;}
	.portrait{ width: 60px; height: 60px;border-radius: 50%; overflow: hidden; float: right; position: absolute; top:1rem; right:1rem;}
    .compile{position:fixed; top:1.2rem;right:1.2rem; z-index: 1000; color:#fff;font-size: 1.2rem;}
    .info .mint-field-core{text-align:right; color: #ccc;border: 1px solid #eee; padding: 0.3rem;}
    .infoButton{position: fixed;left:50%;bottom: 10%;background: #00CC66; color: #fff;width:10rem;border:0; margin-left:-5rem; font-size: 1.3rem;}
    .form-control{position: absolute; top:2rem; right: 0;width:80px; opacity: 0;}
    .info .div-padding-box{margin: 10px 0 10px 0;}
</style>
<script>
	import router from './../../router';
    import util from './../../js/util/util.js'; 
    import vHeader from './../common/Header.vue';
    import{Cell,Toast} from 'mint-ui';
    export default {
    	data(){
    		return {
//  			 isImage:false,
//  			 isAdd:true,
    			 userData:{},
    			 teamData:{},
    			 avatar: 'this.src="' + require('../../../kbc/h5/img/css/common/man.png') + '"',
				 memberName:''
    		}
    	},
    	created() {
    		 this.$store.state.headings=this.$router.history.current.name; //修改标题
    		 this.$store.state.isFooterShow=false; //显示底部导航
    	},
        components:{
            vHeader,
            Toast,
            Cell
        },
        methods:{
			teamInfoCount:function(){ //获取钱包信息
				let $this = this;
				//显示数据
        		 util.Ajax('/userCentered/teamInfoCount', "POST", {}, function(data) { //成功
         	         if(data) {
						if(data.code == "0") {
							$this.teamData = data.teamInfoMap;
						} else {
							Toast(data.msg);
						}
					}
		        })
			}
        },mounted: function () { //加载完成后执行
//      	this.userData = this.$route.query.data;
        	let $this = this;
			util.Ajax('/userCentered/getMemeberById', "POST", {}, function(data) { //成功
				if(data) {
					if(data.code == "0") {
						$this.userData = data.member;
						$this.memberName = util.getMemberName(data.member.level);
						$this.teamInfoCount();
					} else {
						Toast(data.msg);
					}
				}
			});
//			util.Ajax('/userCentered/teamInfoCount', "POST", {}, function(data) { //成功
//				if(data) {
//					if(data.code == "0") {
//						$this.teamData = data.teamInfoMap;
//					} else {
//						Toast(data.msg);
//					}
//				}
//			})
      	}
    }
</script>
